using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;


namespace hosted_gmail_client
{
    public partial class Options : Form
    {
        public bool AccountChanged;

        public Options()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void textBox_TextChanged(object sender, EventArgs e)
        {
            btnApply.Enabled = true;
            AccountChanged = true;
        }

        private void btnApply_Click(object sender, EventArgs e)
        {
            using (RegistryKey key = Common.GetRegistryKey(true))
            {
                key.SetValue("emailaddress", txtEmailAddress.Text);
                key.SetValue("password", txtPassword.Text);
            }

            this.DialogResult = DialogResult.OK;
        }

        private void Options_Load(object sender, EventArgs e)
        {
            using (RegistryKey key = Common.GetRegistryKey(false))
            {
                txtEmailAddress.Text = (string)key.GetValue("emailaddress");
                txtPassword.Text = (string)key.GetValue("password");
            }

            AccountChanged = false;
        }
    }
}